package ihm_clarifiee.Base_Ajout_Independante;

import ihm_clarifiee.Presentation.popup.Popup_Ajout_Histoire;
import javax.swing.JFrame;
import javax.swing.JPanel;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Base_Ajout.java
 *
 * Created on 9 mai 2011, 21:24:15
 */
/**
 *
 * @author Simon
 */
public class Base_Ajout extends javax.swing.JPanel {

	/*** Fake attributs pour tester ***/
	
	// Ici un tableau de string � 2 dimensions, pour l'exemple
	static String[][] fake_table = {	{"nom1", "descr1", "stat1", "blabla1", "last1"} ,
								{"nom2", "descr2", "stat2", "blabla2", "last2"} };
	/**********************************/
	
	
	
	
    /** Creates new form Base_Ajout */
    public Base_Ajout() {
        initComponents();
        m_modele_table = new model_table_backlog();
        m_table.setModel(m_modele_table);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        m_table = new javax.swing.JTable();
        m_bt_ajouter = new javax.swing.JButton();
        
        jScrollPane1.setViewportView(m_table);

        m_bt_ajouter.setText("Ajouter");
        m_bt_ajouter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	m_bt_ajouterActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 418, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(m_bt_ajouter, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 137, Short.MAX_VALUE)
                    .addComponent(m_bt_ajouter))
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JButton m_bt_ajouter;
    private static javax.swing.JTable m_table;
    // End of variables declaration//GEN-END:variables
    
    private static model_table_backlog m_modele_table;
    
    
    
    private void m_bt_ajouterActionPerformed(java.awt.event.ActionEvent evt) {  
    	// On cr�e la fen�tre d'ajout, en lui donnant :
    	//		- La table � modifier (partie m�tier)
    	//		- Le composant de l'IHM � modifier
    	
    	//JFrame popup = new Popup_Ajout_Histoire(fake_table, m_modele_table);
    	//popup.setVisible(true);
    } 
    
    public static void main(String[] args) {
		JFrame frame_base = new JFrame();
		JPanel panel_base = new Base_Ajout();
		
		frame_base.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		System.out.println(panel_base.getPreferredSize().toString());
		frame_base.setSize(panel_base.getPreferredSize());
		
		frame_base.add(panel_base);
		frame_base.setVisible(true);
		
		//m_modele_table.add(fake_table[1]);
	}
}
